ai_memory_tick = {
    if = {
        limit = { is_ai = yes }
        change_variable = { which = ai_memory_score value = 1 }
        if = {
            limit = { check_variable = { which = ai_memory_score value > 20 } }
            add_trait = haunted
        }
        if = {
            limit = { check_variable = { which = ai_memory_score value > 40 } }
            add_trait = sage
            add_character_flag = ai_wise
        }
    }
}